
import 'dart:convert';

import 'package:ichinesereader/models/common/Settings.dart';

ProfileTeacher profileTeacherFromJson(String str) =>
    ProfileTeacher.fromJson(json.decode(str));

String profileTeacherToJson(ProfileTeacher data) => json.encode(data.toJson());

class ProfileTeacher {
  ProfileTeacher({
    this.userId,
    this.userName,
    this.email,
    this.firstName,
    this.lastName,
    this.role,
    this.disabled,
    this.timestampDisabled,
    this.timestampEnabled,
    this.timestampCreated,
    this.timestampPasswordChanged,
    this.profileImageUrl,
    this.settings,
    this.deleted,
    this.lastLoggedIn,
    this.lastLogIn,
    this.gender,
    this.address,
    this.city,
    this.state,
    this.country,
    this.schoolName,
    this.theme,
    this.lang,
  });

  String? userId;
  String? userName;
  String? email;
  String? firstName;
  String? lastName;
  List<String>? role;
  bool? disabled;
  dynamic timestampDisabled;
  dynamic timestampEnabled;
  int? timestampCreated;
  int? timestampPasswordChanged;
  dynamic profileImageUrl;
  Settings? settings;
  bool? deleted;
  int? lastLoggedIn;
  dynamic lastLogIn;
  dynamic gender;
  dynamic address;
  dynamic city;
  dynamic state;
  dynamic country;
  String? schoolName;
  int? theme;
  int? lang;

  factory ProfileTeacher.fromJson(Map<String, dynamic> json) => ProfileTeacher(
        userId: json["userId"],
        userName: json["userName"],
        email: json["email"],
        firstName: json["firstName"],
        lastName: json["lastName"],
        role: json["role"] != null
            ? List<String>.from(json["role"].map((x) => x))
            : null,
        disabled: json["disabled"],
        timestampDisabled: json["timestampDisabled"],
        timestampEnabled: json["timestampEnabled"],
        timestampCreated: json["timestampCreated"],
        timestampPasswordChanged: json["timestampPasswordChanged"],
        profileImageUrl: json["profileImageUrl"],
        settings: json["settings"] != null
            ? Settings.fromJson(json["settings"])
            : null,
        deleted: json["deleted"],
        lastLoggedIn: json["lastLoggedIn"],
        lastLogIn: json["lastLogIn"],
        gender: json["gender"],
        address: json["address"],
        city: json["city"],
        state: json["state"],
        country: json["country"],
        schoolName: json["schoolName"],
        theme: json["theme"] ?? 0,
        lang: json["lang"] ?? 0,
      );

  Map<String, dynamic> toJson() => {
        "userId": userId,
        "userName": userName,
        "email": email,
        "firstName": firstName,
        "lastName": lastName,
        "role": role != null ? List<dynamic>.from(role!.map((x) => x)) : null,
        "disabled": disabled,
        "timestampDisabled": timestampDisabled,
        "timestampEnabled": timestampEnabled,
        "timestampCreated": timestampCreated,
        "timestampPasswordChanged": timestampPasswordChanged,
        "profileImageUrl": profileImageUrl,
        "settings": settings?.toJson(),
        "deleted": deleted,
        "lastLoggedIn": lastLoggedIn,
        "lastLogIn": lastLogIn,
        "gender": gender,
        "address": address,
        "city": city,
        "state": state,
        "country": country,
        "schoolName": schoolName,
        "theme": theme,
        "lang": lang,
      };
}
